package watercalc;

public class Arguments {
	
	public static final String HELP = "--help";
	public static final String ADJACENCY4 = "-adjacency=4";
	public static final String ADJACENCY8 = "-adjacency=8";
	
	public static void check(String[] iArgs) {
		if (iArgs.length < 1 || iArgs.length > 2) {
			exitWrongArgs();
		}
		if (iArgs.length == 2) {
			if (iArgs[1] != ADJACENCY4 && iArgs[1] != ADJACENCY8) {
				exitWrongArgs();
			}
		}
	}

	public static void displayHelp() {
		System.out.println("usage: C:\\>WaterCalc.exe [inputfile] [-adjacency=4|8] ");
		System.out.println("-adjacency parameter is optional default is 4-way adjacency.");
	}

	public static void exitWrongArgs() {
		displayHelp();
		System.exit(WaterCalc.EXIT_FAILURE);
	}

	public static void exitDisplayHelp() {
		displayHelp();
		System.exit(WaterCalc.EXIT_SUCCESS);
	}
	
}
